package com.ctbu.configure;

import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置tomcat下的虚拟目录：核心思想就将本地的文件夹当成项目资源用tomcat的形式提供访问
 */
@Configuration
//@Component
public class TomcatDocResource implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //addResourceHandler 配置访问路径
        //addResourceLocations 配置资源的具体地址
        //虽然能使用但是影响项目原有的请求
        registry.addResourceHandler("/loan-images/**").addResourceLocations("file:E:\\比特就业课\\test_java\\JavaEE进阶代码\\ctbu-loan\\loan-images\\");
    }
}